package com.coolwen.entity;

import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;

public class User {
    private Long userId;

    private String userName;

    private Byte userAge;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @NotEmpty(message = "用户名不能为空")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName == null ? null : userName.trim();
    }



    /***
     使用hibernate validator出现上面的错误， 需要 注意
    @NotNull 和 @NotEmpty  和@NotBlank 区别
    @NotEmpty 用在集合类上面
    @NotBlank 用在String上面
    @NotNull    用在基本类型上
    如果在基本类型上面用NotEmpty或者NotBlank 会出现上面的错
     **/
    @NotNull(message = "年龄不能为空")
    public Byte getUserAge() {
        return userAge;
    }


    public void setUserAge(Byte userAge) {
        this.userAge = userAge;
    }
}